package lottery

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.rdd.RDD

/**
 * @author 小小爱欧
 * @date 2022/8/12 15:47
 */
object Resut {
  def main(args: Array[String]): Unit = {
    val sparkconf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("anli2")
    val sc = new SparkContext(sparkconf)
    val rdd: RDD[String] = sc.textFile("F:\\sportFile\\python\\jupyter\\test\\双色球中奖信息.xlsx")
    val flatMapRDD: RDD[String] = rdd.flatMap(
      wordSplit => {
        wordSplit.split(",")
      }
    )
    val mapRDD: RDD[(String, Int)] = flatMapRDD.map(
      action => {
        (action, 1)
      }
    )
    val value: RDD[(String, Int)] = mapRDD.reduceByKey(_ + _).sortBy(_._2)



    rdd.collect().foreach(println)
    sc.stop()
  }

}
